﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.DAL
{
    public abstract class DuanDAL: clsBaseDAL
    {
        public DataTable Duan_LayDanhsach()
        {
            return base.Select("sp_Duan_LayDanhsach");
        }

        public DataTable Duan_LayTheoMa(string xlMa)
        {
            string xlSPName = "sp_Duan_LayTheoMa";
            string[] xlSPPara = { "@Ma" };
            string[] xlSPValu = { xlMa };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public DataTable Duan_LayChitiet(long xlId)
        {
            string xlSPName = "sp_Duan_LayChitiet";
            string[] xlSPPara = { "@Id" };
            object[] xlSPValu = { xlId };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public bool Duan_Them(DAL.Entities.Duan DA)
        {
            string xlSPName = "sp_Duan_Them";
            string[] xlSPPara = {  "@Id"
                                   ,"@Ma"
                                    ,"@Ten"
                                    ,"@Ngaylap"
                                    ,"@Ngaybatdau"
                                    ,"@xNgayhoanthanh"
                                    ,"@Ngayhoanthanh"
                                    ,"@Ma_NhanvienLap"
                                    ,"@Ma_NhanvienLam"
                                    ,"@Ghichu"

                                };

            object[] xlSPValu = {   DA.Id
                                    ,DA.Ma
                                    ,DA.Ten
                                    ,DA.Ngaylap
                                    ,DA.Ngaybatdau
                                    ,DA.xNgayhoanthanh
                                    ,DA.Ngayhoanthanh
                                    ,DA.Ma_NhanvienLap
                                    ,DA.Ma_NhanvienLam
                                    ,DA.Ghichu

                                 };
            return base.Insert(xlSPName, xlSPPara, xlSPValu);
        }

        public bool Duan_Capnhat(DAL.Entities.Duan DA, string Macu)
        {
            string xlSPName = "sp_Duan_Capnhat";
            string[] xlSPPara = {  
                                "@Macu"                        
                                ,"@Ma"
                                ,"@Ten"
                                ,"@Ngaylap"
                                ,"@Ngaybatdau"
                                ,"@xNgayhoanthanh"
                                ,"@Ngayhoanthanh"
                                ,"@Ma_NhanvienLap"
                                ,"@Ma_NhanvienLam"
                                ,"@Ghichu"
                                };

            object[] xlSPValu = {   Macu
                                   ,DA.Ma
                                    ,DA.Ten
                                    ,DA.Ngaylap
                                    ,DA.Ngaybatdau
                                    ,DA.xNgayhoanthanh
                                    ,DA.Ngayhoanthanh
                                    ,DA.Ma_NhanvienLap
                                    ,DA.Ma_NhanvienLam
                                    ,DA.Ghichu

                                 };
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }

        public bool Duan_Xoa(long Id)
        {
            string xlSPName = "sp_Duan_Xoa";
            string[] xlSPPara = { "@Id" };
            object[] xlSPValu = { Id};
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }
    }
}
